var auth = "2f3d057c03edcc54f3d34a627db3be67"
var url = "http://192.168.209.33/sailun/api_jsonrpc.php"

function alertGetNow() {
    var date_stamp = Date.parse(new Date()) / 1000;
    // 当前时间戳,js获取的时间精确到毫秒，需要除以1000
    var date_past = date_stamp - (24 * 60 * 60);
    // 过去24小时的报警
    // console.log(date_past,date_stamp)
    // 打印时间戳
    var json_data = JSON.stringify({
        "jsonrpc": "2.0",
        "method": "trigger.get",
        "params": {
            "only_true": '1',
            "active": '1',
            "monitored": '1',
            "output": 'extend',
            "expandDescription": 1,
            "selectHosts": ['name'],
            "selectItems": ['name', 'description'],
            "filter": { "value": 1 }
        },
        'auth': auth,
        'id': '3'
    });
    $.ajax({
        url: url,
        method: 'post',
        dataType: 'json',
        headers: { "Content-Type": "application/json" },
        data: json_data,
        success: function(data) {
            console.log(data.result);
            alert_array = data.result;
            for (i in alert_array) {
                console.log(alert_array[i].hosts[0].name, alert_array[i].description)
				document.getElementById("text_baojingdescription").value = alert_array[i].description;
				document.getElementById("text_baojinghost").value = alert_array[i].hosts[0].name;
            }
            // alert(data.result)
            // 请求成功后的结果放在data里面
        }
    });
}